package com.mazaiting.redeye.domain;

import com.fasterxml.jackson.core.type.TypeReference;
import com.mazaiting.redeye.interfaces.IJsonBean;
import com.mazaiting.redeye.utils.JackJsonUtil;

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-07-09
 * @decription 验证码实体
 */
public class VerifyCodeBean<T> implements IJsonBean {

    /**
     * 验证码
     */
    private String verifyCode;
    /**
     * 数据
     */
    private T data;

    public String getVerifyCode() {
        return verifyCode;
    }

    public void setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "VerifyCodeBean{" +
                "verifyCode='" + verifyCode + '\'' +
                ", data=" + data +
                '}';
    }

    @Override
    public String toJson() {
        return JackJsonUtil.toJson(this);
    }

    @Override
    public VerifyCodeBean fromJson(String content) {
        return JackJsonUtil.formJson(content, VerifyCodeBean.class);
    }

    /**
     * 验证码结果 Bean
     */
    public static class ResultBean implements IJsonBean{
        /**
         * 状态
         * 200: 成功
         */
        private int status;
        /**
         * 异常信息
         */
        private String error;

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public String getError() {
            return error;
        }

        public void setError(String error) {
            this.error = error;
        }

        @Override
        public String toJson() {
            return JackJsonUtil.toJson(this);
        }

        @Override
        public ResultBean fromJson(String content) {
            return JackJsonUtil.formJson(content, ResultBean.class);
        }
    }
}
